Skip to content

controllerrevision not cleaned up after Postgresql deletion #2913

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fabianem opened this issue May 19, 2025 · 0 comments
Open

controllerrevision not cleaned up after Postgresql deletion #2913

fabianem opened this issue May 19, 2025 · 0 comments

Comments

@fabianem
Copy link

Please, answer some short questions which should help us to understand your problem / question better?

  • Which image of the operator are you using? ghcr.io/zalando/postgres-operator:v1.14.0
  • Where do you run it - cloud or metal? Kubernetes or OpenShift? [AWS K8s | GCP ... | Bare Metal K8s] K8s
  • Are you running Postgres Operator in production? [yes | no] yes
  • Type of issue? [Bug report, question, feature request, etc.] Bug report

Hi,

I’m running the Zalando Postgres Operator in cluster-wide mode, and overall the resource cleanup during Postgresql instance deletion works well. However, I’ve observed that controllerrevision resources are left behind after deleting a Postgresql CR - even though other resources like StatefulSets, Pods, Services, and Secrets are properly removed.

My operator configuration includes enable_owner_references: true:

configKubernetes:
    pod_management_policy: "parallel"
    enable_persistent_volume_claim_deletion: true
    enable_finalizers: false
    enable_owner_references: true
    enable_pod_antiaffinity: false
    cluster_domain: "cluster.local"
...

Upon inspecting the controllerrevision resource before deletion, it correctly has an ownerReference pointing to the corresponding StatefulSet. However, after the Postgresql CR is deleted and the StatefulSet is removed, the controllerrevision remains - and its ownerReference is gone.

This suggests that the controllerrevision becomes orphaned during the deletion process. I suspect this might be due to the use of metav1.DeletePropagationOrphan when deleting the StatefulSet.

Would switching to DeletePropagationForeground be more appropriate here to allow Kubernetes to garbage collect the controllerrevision via its ownership chain?

Thanks in advance for looking into this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant